// A4. Does Distance from School Predict Observables?
// A4. Does Distance from School Predict Observables?
// A4. Does Distance from School Predict Observables?


// PRELIMINARIES

clear
set more off
set scheme s1mono



// LOAD DATA
	
use "JakielaOzierFernaldKnauer-preschool-data.dta", replace


cap program drop ivcheck
program define ivcheck
confirm numeric var `1'
confirm e `2'

 des `1'
 local l`1' : variable label `1'

 
  reg `1' schdist if roundage==3, cluster(respid)
  mat V = r(table)
  local _beta = string(V[1,1],"%04.3f")
  local _se = string(V[2,1],"%04.3f")
  local _pval = string(V[4,1],"%04.3f")

 file write `2' "`l`1'' & `_beta' & `_se' & `_pval' \\ " _newline

 end
 
 
cap file close fh
file open fh using "out/A4-ivcheck.tex", write replace

foreach var of varlist childage haz male cgmom momeduc momluo dadabsent_raw dadeduc_raw dadluo_raw ///
	hhsize sibs numassets {
	ivcheck `var' fh
}

file close fh
